
import Fetch from "../modules/fetch"
import $ from 'jquery'

class HeaderLunbo extends React.Component {
	constructor(props) {
		super(props)
		this.state = {
			carsouselPic: []
		}
	}
	componentWillMount() {
//https://api.bilibili.com/x/web-show/res/loc?jsonp=jsonp&pf=7&id=1695

//		Fetch.Get('http://localhost:9000/bili/x/web-show/res/loc',{
//			json:'json',
//			pf:7,
//			id:1695
//		})
//			.then(res=>{
//				return res.json()
//			})
//			.then(json=>{
//				this.setState({
//					carsouselPic: json.data
//				})
//	        })
	}
//	showBanner(){
//		let that=this
//		let arr=[]
//		 this.state.carsouselPic.forEach((item,i)=>{
//		 	arr.push(
//		 		<div className="swiper-slide"><img src={item.pic} /></div>
//		 	)
//		 })
//		return arr
//
//	}
//	
	
	changeTowhat(){
		$(location).attr('href', '#/sec');
	}
	
	render() {
		return (
			<div className="carousel" onClick={this.changeTowhat}>
				<div className="swiper-container">
       				<div className="swiper-wrapper">

       					<div className="swiper-slide abc"><img src='./lib/images/p2.jpg' /></div>
       					<div className="swiper-slide abc"><img src='./lib/images/p3.jpg' /></div>
       					<div className="swiper-slide abc"><img src='./lib/images/p1.jpg' /></div>
       					
       				</div>
       				<div className="swiper-pagination"></div>
       			</div>
			</div>
		)
	}
	componentDidMount() {
		var swiper = new Swiper('.carousel>.swiper-container', {
//	        pagination: '.swiper-pagination',
//	        nextButton: '.swiper-button-next',
//	        prevButton: '.swiper-button-prev',
	        paginationClickable: true,
//	        spaceBetween: 30,
//	        centeredSlides: true,
	        autoplay: 2000,
	        autoplayDisableOnInteraction: false,
	        loop: true
	    });
	}
}

export default HeaderLunbo